VERSION 5.00
Object = "{C4847593-972C-11D0-9567-00A0C9273C2A}#8.0#0"; "crviewer.dll"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{B3FB64BF-91F9-11D7-A482-0008A14158BC}#2.22#0"; "ITGControls.ocx"
Begin VB.Form frmMaintCustomerSupplier 
   BackColor       =   &H00F7D9C2&
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   8550
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   10770
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MDIChild        =   -1  'True
   ScaleHeight     =   8550
   ScaleWidth      =   10770
   ShowInTaskbar   =   0   'False
   Begin ITGControls.ITGTab SSTab2 
      Height          =   7080
      Left            =   0
      TabIndex        =   34
      Top             =   1020
      Width           =   10605
      _ExtentX        =   18706
      _ExtentY        =   12488
      TabCaption(0)   =   "               Main               "
      TabContCtrlCnt(0)=   1
      Tab(0)ContCtrlCap(1)=   "ComunionFrames1"
      TabCaption(1)   =   "               List               "
      TabContCtrlCnt(1)=   1
      Tab(1)ContCtrlCap(1)=   "dtgList"
      TabCaption(2)   =   "               Aging               "
      TabEnabled(2)   =   0   'False
      TabContCtrlCnt(2)=   1
      Tab(2)ContCtrlCap(1)=   "ITGReportViewer"
      TabTheme        =   2
      ActiveTabBackStartColor=   16250865
      ActiveTabBackEndColor=   16243138
      InActiveTabBackStartColor=   16243138
      InActiveTabBackEndColor=   16243138
      InActiveTabForeColor=   0
      BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      OuterBorderColor=   4210752
      TopLeftInnerBorderColor=   4210752
      BottomRightInnerBorderColor=   4210752
      DisabledTabBackColor=   16243138
      DisabledTabForeColor=   -2147483630
      Begin MSDataGridLib.DataGrid dtgList 
         Height          =   6765
         Left            =   -75000
         TabIndex        =   32
         Top             =   315
         Width           =   10605
         _ExtentX        =   18706
         _ExtentY        =   11933
         _Version        =   393216
         AllowUpdate     =   0   'False
         AllowArrows     =   -1  'True
         Appearance      =   0
         HeadLines       =   1
         RowHeight       =   15
         TabAction       =   2
         FormatLocked    =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   3
         BeginProperty Column00 
            DataField       =   "cCode"
            Caption         =   "Supplier ID"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "cName"
            Caption         =   "Supplier Name"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "cAddress"
            Caption         =   "Address"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            AllowRowSizing  =   0   'False
            BeginProperty Column00 
               ColumnAllowSizing=   -1  'True
               Locked          =   -1  'True
               ColumnWidth     =   1695.118
            EndProperty
            BeginProperty Column01 
               Locked          =   -1  'True
               ColumnWidth     =   3404.977
            EndProperty
            BeginProperty Column02 
               ColumnWidth     =   4770.142
            EndProperty
         EndProperty
      End
      Begin CRVIEWERLibCtl.CRViewer ITGReportViewer 
         Height          =   6180
         Left            =   -74985
         TabIndex        =   33
         Top             =   330
         Visible         =   0   'False
         Width           =   10575
         lastProp        =   500
         _cx             =   5080
         _cy             =   5080
         DisplayGroupTree=   0   'False
         DisplayToolbar  =   -1  'True
         EnableGroupTree =   0   'False
         EnableNavigationControls=   -1  'True
         EnableStopButton=   -1  'True
         EnablePrintButton=   -1  'True
         EnableZoomControl=   -1  'True
         EnableCloseButton=   -1  'True
         EnableProgressControl=   -1  'True
         EnableSearchControl=   -1  'True
         EnableRefreshButton=   0   'False
         EnableDrillDown =   -1  'True
         EnableAnimationControl=   -1  'True
         EnableSelectExpertButton=   0   'False
         EnableToolbar   =   -1  'True
         DisplayBorder   =   0   'False
         DisplayTabs     =   0   'False
         DisplayBackgroundEdge=   -1  'True
         SelectionFormula=   ""
         EnablePopupMenu =   -1  'True
         EnableExportButton=   -1  'True
         EnableSearchExpertButton=   0   'False
         EnableHelpButton=   0   'False
         LaunchHTTPHyperlinksInNewBrowser=   -1  'True
      End
      Begin ITGControls.ComunionFrames ComunionFrames1 
         Height          =   6765
         Left            =   0
         Top             =   315
         Width           =   10605
         _ExtentX        =   18706
         _ExtentY        =   11933
         FrameColor      =   4210752
         BackColor       =   16243138
         FillColor       =   16243138
         RoundedCorner   =   0   'False
         Caption         =   "Information"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ThemeColor      =   5
         ColorFrom       =   16243138
         ColorTo         =   16250865
         Begin VB.ComboBox cboEwtType 
            Appearance      =   0  'Flat
            BackColor       =   &H00FFFFFF&
            Height          =   315
            ItemData        =   "frmMaintCustomerSupplier.frx":0000
            Left            =   1650
            List            =   "frmMaintCustomerSupplier.frx":001F
            Style           =   2  'Dropdown List
            TabIndex        =   52
            Top             =   2745
            Width           =   1410
         End
         Begin VB.Timer Timer1 
            Interval        =   300
            Left            =   3180
            Top             =   465
         End
         Begin VB.ComboBox cboSType 
            Appearance      =   0  'Flat
            BackColor       =   &H00FFFFFF&
            Height          =   315
            ItemData        =   "frmMaintCustomerSupplier.frx":0066
            Left            =   7950
            List            =   "frmMaintCustomerSupplier.frx":0070
            Style           =   2  'Dropdown List
            TabIndex        =   3
            Top             =   840
            Width           =   2340
         End
         Begin VB.ComboBox cboSCountry 
            Height          =   315
            Left            =   1650
            Style           =   2  'Dropdown List
            TabIndex        =   9
            Top             =   1785
            Width           =   4200
         End
         Begin ITGControls.ITGTab SSTab4 
            Height          =   2970
            Left            =   0
            TabIndex        =   36
            Top             =   3795
            Width           =   10590
            _ExtentX        =   18680
            _ExtentY        =   5239
            TabCount        =   4
            TabCaption(0)   =   "     Basic     "
            TabContCtrlCnt(0)=   11
            Tab(0)ContCtrlCap(1)=   "txtSDepartment"
            Tab(0)ContCtrlCap(2)=   "txtSBalance"
            Tab(0)ContCtrlCap(3)=   "txtSPayment"
            Tab(0)ContCtrlCap(4)=   "txtSReturns"
            Tab(0)ContCtrlCap(5)=   "txtSCredit"
            Tab(0)ContCtrlCap(6)=   "txtSDebit"
            Tab(0)ContCtrlCap(7)=   "txtSPurchase"
            Tab(0)ContCtrlCap(8)=   "txtSCL"
            Tab(0)ContCtrlCap(9)=   "cmdPickSDept"
            Tab(0)ContCtrlCap(10)=   "cboSTerms"
            Tab(0)ContCtrlCap(11)=   "txtSTerms"
            TabCaption(1)   =   "     Addresses / Contacts     "
            TabContCtrlCnt(1)=   2
            Tab(1)ContCtrlCap(1)=   "cboSCountryDetails"
            Tab(1)ContCtrlCap(2)=   "dtgSAddress"
            TabCaption(2)   =   "     Product Line     "
            TabContCtrlCnt(2)=   2
            Tab(2)ContCtrlCap(1)=   "cboSPD"
            Tab(2)ContCtrlCap(2)=   "dtgSProduct"
            TabCaption(3)   =   "     History     "
            TabContCtrlCnt(3)=   3
            Tab(3)ContCtrlCap(1)=   "dtgSHistory"
            Tab(3)ContCtrlCap(2)=   "cmdSHistory"
            Tab(3)ContCtrlCap(3)=   "Frame7"
            TabTheme        =   2
            ActiveTabBackEndColor=   16243138
            InActiveTabBackStartColor=   16243138
            InActiveTabBackEndColor=   16243138
            BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            OuterBorderColor=   4210752
            TopLeftInnerBorderColor=   4210752
            BottomRightInnerBorderColor=   4210752
            DisabledTabBackColor=   16243138
            DisabledTabForeColor=   -2147483630
            Begin MSDataGridLib.DataGrid dtgSHistory 
               Height          =   2640
               Left            =   -72735
               TabIndex        =   31
               Top             =   330
               Width           =   8340
               _ExtentX        =   14711
               _ExtentY        =   4657
               _Version        =   393216
               AllowUpdate     =   -1  'True
               HeadLines       =   1
               RowHeight       =   15
               FormatLocked    =   -1  'True
               BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               ColumnCount     =   6
               BeginProperty Column00 
                  DataField       =   "dDate"
                  Caption         =   "Date"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   0
                     Format          =   ""
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   0
                  EndProperty
               EndProperty
               BeginProperty Column01 
                  DataField       =   "cWRRNo"
                  Caption         =   "WRR No."
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   0
                     Format          =   ""
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   0
                  EndProperty
               EndProperty
               BeginProperty Column02 
                  DataField       =   "nGross"
                  Caption         =   "Gross"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   1
                     Format          =   "#,##0.00"
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   1
                  EndProperty
               EndProperty
               BeginProperty Column03 
                  DataField       =   "nPaid"
                  Caption         =   "Payment"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   1
                     Format          =   "#,##0.00"
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   1
                  EndProperty
               EndProperty
               BeginProperty Column04 
                  DataField       =   "nCMDMReturn"
                  Caption         =   "CM/DM/Returns"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   1
                     Format          =   "#,##0.00"
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   1
                  EndProperty
               EndProperty
               BeginProperty Column05 
                  DataField       =   "nBalance"
                  Caption         =   "Balance"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   1
                     Format          =   "#,##0.00"
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   1
                  EndProperty
               EndProperty
               SplitCount      =   1
               BeginProperty Split0 
                  BeginProperty Column00 
                     ColumnWidth     =   1244.976
                  EndProperty
                  BeginProperty Column01 
                     ColumnWidth     =   1365.165
                  EndProperty
                  BeginProperty Column02 
                     Alignment       =   1
                  EndProperty
                  BeginProperty Column03 
                     Alignment       =   1
                  EndProperty
                  BeginProperty Column04 
                     Alignment       =   1
                  EndProperty
                  BeginProperty Column05 
                     Alignment       =   1
                  EndProperty
               EndProperty
            End
            Begin ITGControls.ITGCommandButton cmdSHistory 
               Height          =   315
               Left            =   -74910
               TabIndex        =   30
               Top             =   1665
               Width           =   2115
               _ExtentX        =   3731
               _ExtentY        =   556
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Caption         =   "Show History"
            End
            Begin VB.Frame Frame7 
               Appearance      =   0  'Flat
               BackColor       =   &H00F7D9C2&
               Caption         =   " Date Range "
               ForeColor       =   &H80000008&
               Height          =   1260
               Left            =   -74925
               TabIndex        =   43
               Top             =   345
               Width           =   2115
               Begin ITGControls.ITGDateBox dtbSFrom 
                  Height          =   285
                  Left            =   720
                  TabIndex        =   28
                  Top             =   390
                  Width           =   1305
                  _ExtentX        =   2302
                  _ExtentY        =   503
                  BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                     Name            =   "Tahoma"
                     Size            =   8.25
                     Charset         =   0
                     Weight          =   400
                     Underline       =   0   'False
                     Italic          =   0   'False
                     Strikethrough   =   0   'False
                  EndProperty
                  Text            =   ""
                  SendKeysTab     =   -1  'True
               End
               Begin ITGControls.ITGDateBox dtbSTo 
                  Height          =   285
                  Left            =   720
                  TabIndex        =   29
                  Top             =   705
                  Width           =   1305
                  _ExtentX        =   2302
                  _ExtentY        =   503
                  BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                     Name            =   "Tahoma"
                     Size            =   8.25
                     Charset         =   0
                     Weight          =   400
                     Underline       =   0   'False
                     Italic          =   0   'False
                     Strikethrough   =   0   'False
                  EndProperty
                  Text            =   ""
                  SendKeysTab     =   -1  'True
               End
               Begin VB.Label Label4 
                  AutoSize        =   -1  'True
                  BackStyle       =   0  'Transparent
                  Caption         =   "To"
                  Height          =   195
                  Left            =   180
                  TabIndex        =   50
                  Top             =   705
                  Width           =   180
               End
               Begin VB.Label Label5 
                  AutoSize        =   -1  'True
                  BackStyle       =   0  'Transparent
                  Caption         =   "From"
                  Height          =   195
                  Left            =   180
                  TabIndex        =   49
                  Top             =   420
                  Width           =   360
               End
            End
            Begin VB.ComboBox cboSPD 
               Height          =   315
               Left            =   -74880
               Style           =   2  'Dropdown List
               TabIndex        =   42
               Top             =   2400
               Visible         =   0   'False
               Width           =   1395
            End
            Begin VB.ComboBox cboSCountryDetails 
               Height          =   315
               Left            =   -74835
               Style           =   2  'Dropdown List
               TabIndex        =   41
               Top             =   2430
               Visible         =   0   'False
               Width           =   2910
            End
            Begin ITGControls.ITGTextBox txtSDepartment 
               Height          =   285
               Left            =   195
               TabIndex        =   16
               Tag             =   "S"
               Top             =   510
               Width           =   3165
               _ExtentX        =   5371
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               MaxLength       =   10
               Label           =   "Department"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1080
               TextBoxWidth    =   2025
            End
            Begin ITGControls.ITGTextBox txtSBalance 
               Height          =   285
               Left            =   7395
               TabIndex        =   25
               Tag             =   "S"
               Top             =   2085
               Width           =   2640
               _ExtentX        =   4445
               _ExtentY        =   503
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   700
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   "0"
               DataType        =   1
               MaximumValue    =   9999999999.99
               DecimalPlace    =   2
               Label           =   "Balance"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1015
               TextBoxWidth    =   1565
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtSPayment 
               Height          =   285
               Left            =   7395
               TabIndex        =   24
               Tag             =   "S"
               Top             =   1770
               Width           =   2640
               _ExtentX        =   4445
               _ExtentY        =   503
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   "0"
               DataType        =   1
               MaximumValue    =   9999999999.99
               DecimalPlace    =   2
               Label           =   "Payment"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1015
               TextBoxWidth    =   1565
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtSReturns 
               Height          =   285
               Left            =   7395
               TabIndex        =   23
               Tag             =   "S"
               Top             =   1455
               Width           =   2640
               _ExtentX        =   4445
               _ExtentY        =   503
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   "0"
               DataType        =   1
               MaximumValue    =   9999999999.99
               DecimalPlace    =   2
               Label           =   "Returns"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1015
               TextBoxWidth    =   1565
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtSCredit 
               Height          =   285
               Left            =   7395
               TabIndex        =   22
               Tag             =   "S"
               Top             =   1140
               Width           =   2640
               _ExtentX        =   4445
               _ExtentY        =   503
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   "0"
               DataType        =   1
               MaximumValue    =   9999999999.99
               DecimalPlace    =   2
               Label           =   "Credit"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1015
               TextBoxWidth    =   1565
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtSDebit 
               Height          =   285
               Left            =   7395
               TabIndex        =   21
               Tag             =   "S"
               Top             =   825
               Width           =   2640
               _ExtentX        =   4445
               _ExtentY        =   503
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   "0"
               DataType        =   1
               MaximumValue    =   9999999999.99
               DecimalPlace    =   2
               Label           =   "Debit"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1015
               TextBoxWidth    =   1565
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtSPurchase 
               Height          =   285
               Left            =   7395
               TabIndex        =   20
               Tag             =   "S"
               Top             =   510
               Width           =   2640
               _ExtentX        =   4445
               _ExtentY        =   503
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   "0"
               DataType        =   1
               MaximumValue    =   9999999999.99
               DecimalPlace    =   2
               Label           =   "Purchase"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1015
               TextBoxWidth    =   1565
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtSCL 
               Height          =   285
               Left            =   195
               TabIndex        =   18
               Tag             =   "S"
               Top             =   825
               Width           =   3165
               _ExtentX        =   5371
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   "0"
               DataType        =   1
               MaximumValue    =   9999999999.99
               DecimalPlace    =   2
               Label           =   "Credit Limit"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1080
               TextBoxWidth    =   2025
            End
            Begin VB.CommandButton cmdPickSDept 
               BeginProperty Font 
                  Name            =   "MS Sans Serif"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Height          =   300
               Left            =   3390
               Picture         =   "frmMaintCustomerSupplier.frx":0084
               Style           =   1  'Graphical
               TabIndex        =   17
               Top             =   510
               Width           =   315
            End
            Begin MSDataGridLib.DataGrid dtgSAddress 
               Height          =   2655
               Left            =   -74985
               TabIndex        =   26
               Top             =   315
               Width           =   10590
               _ExtentX        =   18680
               _ExtentY        =   4683
               _Version        =   393216
               AllowArrows     =   -1  'True
               HeadLines       =   1
               RowHeight       =   15
               TabAcrossSplits =   -1  'True
               TabAction       =   2
               FormatLocked    =   -1  'True
               BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               ColumnCount     =   8
               BeginProperty Column00 
                  DataField       =   "cAddress"
                  Caption         =   "Address"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   0
                     Format          =   ""
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   0
                  EndProperty
               EndProperty
               BeginProperty Column01 
                  DataField       =   "cCity"
                  Caption         =   "City"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   0
                     Format          =   ""
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   0
                  EndProperty
               EndProperty
               BeginProperty Column02 
                  DataField       =   "cState"
                  Caption         =   "State"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   0
                     Format          =   ""
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   0
                  EndProperty
               EndProperty
               BeginProperty Column03 
                  DataField       =   "cCountry"
                  Caption         =   "Country"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   0
                     Format          =   ""
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   0
                  EndProperty
               EndProperty
               BeginProperty Column04 
                  DataField       =   "cZip"
                  Caption         =   "Zip"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   0
                     Format          =   ""
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   0
                  EndProperty
               EndProperty
               BeginProperty Column05 
                  DataField       =   "cContact"
                  Caption         =   "Contact"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   0
                     Format          =   ""
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   0
                  EndProperty
               EndProperty
               BeginProperty Column06 
                  DataField       =   "cTel"
                  Caption         =   "Phone"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   0
                     Format          =   ""
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   0
                  EndProperty
               EndProperty
               BeginProperty Column07 
                  DataField       =   "cFax"
                  Caption         =   "Fax"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   0
                     Format          =   ""
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   0
                  EndProperty
               EndProperty
               SplitCount      =   1
               BeginProperty Split0 
                  BeginProperty Column00 
                     ColumnWidth     =   3344.882
                  EndProperty
                  BeginProperty Column01 
                     ColumnWidth     =   1230.236
                  EndProperty
                  BeginProperty Column02 
                     ColumnWidth     =   1154.835
                  EndProperty
                  BeginProperty Column03 
                     Button          =   -1  'True
                     Locked          =   -1  'True
                     ColumnWidth     =   1620.284
                  EndProperty
                  BeginProperty Column04 
                     ColumnWidth     =   569.764
                  EndProperty
                  BeginProperty Column05 
                  EndProperty
                  BeginProperty Column06 
                  EndProperty
                  BeginProperty Column07 
                     ColumnWidth     =   1275.024
                  EndProperty
               EndProperty
            End
            Begin MSDataGridLib.DataGrid dtgSProduct 
               Height          =   2655
               Left            =   -75000
               TabIndex        =   27
               Top             =   315
               Width           =   10605
               _ExtentX        =   18706
               _ExtentY        =   4683
               _Version        =   393216
               AllowArrows     =   -1  'True
               HeadLines       =   1
               RowHeight       =   15
               TabAction       =   2
               FormatLocked    =   -1  'True
               BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               ColumnCount     =   5
               BeginProperty Column00 
                  DataField       =   "cItemNo"
                  Caption         =   "Product ID"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   0
                     Format          =   ""
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   0
                  EndProperty
               EndProperty
               BeginProperty Column01 
                  DataField       =   "cDesc"
                  Caption         =   "Product Name"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   0
                     Format          =   ""
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   0
                  EndProperty
               EndProperty
               BeginProperty Column02 
                  DataField       =   "nPrice"
                  Caption         =   "Price"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   1
                     Format          =   "#,##0.00"
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   1
                  EndProperty
               EndProperty
               BeginProperty Column03 
                  DataField       =   "cPDCode"
                  Caption         =   "Division"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   0
                     Format          =   ""
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   0
                  EndProperty
               EndProperty
               BeginProperty Column04 
                  DataField       =   "cPDDesc"
                  Caption         =   "Division Description"
                  BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                     Type            =   0
                     Format          =   ""
                     HaveTrueFalseNull=   0
                     FirstDayOfWeek  =   0
                     FirstWeekOfYear =   0
                     LCID            =   1033
                     SubFormatType   =   0
                  EndProperty
               EndProperty
               SplitCount      =   1
               BeginProperty Split0 
                  BeginProperty Column00 
                  EndProperty
                  BeginProperty Column01 
                     ColumnWidth     =   3674.835
                  EndProperty
                  BeginProperty Column02 
                     Alignment       =   1
                     ColumnWidth     =   1665.071
                  EndProperty
                  BeginProperty Column03 
                     Locked          =   -1  'True
                     Object.Visible         =   0   'False
                     ColumnWidth     =   840.189
                  EndProperty
                  BeginProperty Column04 
                     Button          =   -1  'True
                     Locked          =   -1  'True
                     ColumnWidth     =   2624.882
                  EndProperty
               EndProperty
            End
            Begin VB.ComboBox cboSTerms 
               Height          =   315
               ItemData        =   "frmMaintCustomerSupplier.frx":01CE
               Left            =   1305
               List            =   "frmMaintCustomerSupplier.frx":01D0
               Style           =   2  'Dropdown List
               TabIndex        =   19
               Top             =   1140
               Width           =   2040
            End
            Begin ITGControls.ITGTextBox txtSTerms 
               Height          =   285
               Left            =   195
               TabIndex        =   40
               Tag             =   "cboTerms"
               Top             =   1155
               Width           =   2055
               _ExtentX        =   3413
               _ExtentY        =   503
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               MaxLength       =   25
               Mandatory       =   -1  'True
               Label           =   "Terms"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1200
               TextBoxWidth    =   795
               Required        =   -1  'True
            End
         End
         Begin ITGControls.ITGTextBox txtCode 
            Height          =   285
            Left            =   210
            TabIndex        =   0
            Top             =   540
            Width           =   2880
            _ExtentX        =   4868
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            MaxLength       =   25
            Mandatory       =   -1  'True
            Label           =   "Supplier ID"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1410
            TextBoxWidth    =   1410
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtName 
            Height          =   285
            Left            =   210
            TabIndex        =   2
            Top             =   855
            Width           =   6600
            _ExtentX        =   11430
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Supplier Name"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1410
            TextBoxWidth    =   5130
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtSType 
            Height          =   285
            Left            =   8730
            TabIndex        =   38
            Tag             =   "cboType"
            Top             =   855
            Visible         =   0   'False
            Width           =   1320
            _ExtentX        =   2223
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            MaxLength       =   8
            Mandatory       =   -1  'True
            Label           =   "Type"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   1260
         End
         Begin ITGControls.ITGTextBox txtSCountry 
            Height          =   285
            Left            =   4200
            TabIndex        =   39
            Tag             =   "cboCountry"
            Top             =   1800
            Visible         =   0   'False
            Width           =   1335
            _ExtentX        =   2249
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            MaxLength       =   50
            Mandatory       =   -1  'True
            Label           =   "Country"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   1275
         End
         Begin ITGControls.ITGTextBox txtSAddress 
            Height          =   285
            Left            =   210
            TabIndex        =   4
            Tag             =   "S"
            Top             =   1170
            Width           =   6600
            _ExtentX        =   11430
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Mandatory       =   -1  'True
            Label           =   "Address"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1410
            TextBoxWidth    =   5130
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtSFax 
            Height          =   285
            Left            =   7020
            TabIndex        =   8
            Tag             =   "S"
            Top             =   1485
            Width           =   3285
            _ExtentX        =   5583
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            MaxLength       =   20
            Label           =   "Fax"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   900
            TextBoxWidth    =   2325
         End
         Begin ITGControls.ITGTextBox txtSInternet 
            Height          =   285
            Left            =   7020
            TabIndex        =   11
            Tag             =   "S"
            Top             =   1800
            Width           =   3285
            _ExtentX        =   5583
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            MaxLength       =   50
            Label           =   "Internet"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   900
            TextBoxWidth    =   2325
         End
         Begin ITGControls.ITGTextBox txtSEMail 
            Height          =   285
            Left            =   7020
            TabIndex        =   13
            Tag             =   "S"
            Top             =   2115
            Width           =   3285
            _ExtentX        =   5583
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            MaxLength       =   50
            Label           =   "E-mail"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   900
            TextBoxWidth    =   2325
         End
         Begin ITGControls.ITGTextBox txtSContact 
            Height          =   285
            Left            =   210
            TabIndex        =   12
            Tag             =   "S"
            Top             =   2115
            Width           =   6600
            _ExtentX        =   11430
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            MaxLength       =   50
            Label           =   "Contact"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1410
            TextBoxWidth    =   5130
         End
         Begin ITGControls.ITGTextBox txtSDescription 
            Height          =   285
            Left            =   210
            TabIndex        =   14
            Tag             =   "S"
            Top             =   2430
            Width           =   6600
            _ExtentX        =   11430
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            MaxLength       =   50
            Label           =   "Description"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1410
            TextBoxWidth    =   5130
         End
         Begin ITGControls.ITGTextBox txtSCity 
            Height          =   285
            Left            =   210
            TabIndex        =   6
            Tag             =   "S"
            Top             =   1485
            Width           =   3930
            _ExtentX        =   6720
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            MaxLength       =   50
            Label           =   "City / State"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1410
            TextBoxWidth    =   2460
         End
         Begin ITGControls.ITGTextBox txtSState 
            Height          =   285
            Left            =   4140
            TabIndex        =   7
            Tag             =   "S"
            Top             =   1485
            Width           =   2670
            _ExtentX        =   4604
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            MaxLength       =   50
            Label           =   "Street"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   2610
         End
         Begin ITGControls.ITGTextBox txtSZip 
            Height          =   285
            Left            =   5850
            TabIndex        =   10
            Tag             =   "S"
            Top             =   1800
            Width           =   960
            _ExtentX        =   1588
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            MaxLength       =   10
            Label           =   "Street"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   900
         End
         Begin ITGControls.ITGTextBox txtSPhone 
            Height          =   285
            Left            =   7020
            TabIndex        =   5
            Tag             =   "S"
            Top             =   1170
            Width           =   3285
            _ExtentX        =   5583
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            MaxLength       =   20
            Label           =   "Phone"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   900
            TextBoxWidth    =   2325
         End
         Begin ITGControls.ITGTextBox txtSTIN 
            Height          =   285
            Left            =   7020
            TabIndex        =   15
            Tag             =   "S"
            Top             =   2430
            Width           =   3285
            _ExtentX        =   5583
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            MaxLength       =   50
            Label           =   "TIN No."
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   900
            TextBoxWidth    =   2325
         End
         Begin VB.ComboBox cboType 
            Height          =   315
            Left            =   8520
            Style           =   2  'Dropdown List
            TabIndex        =   1
            Top             =   495
            Width           =   1770
         End
         Begin ITGControls.ITGTextBox txtType 
            Height          =   285
            Left            =   9090
            TabIndex        =   37
            Top             =   525
            Visible         =   0   'False
            Width           =   1215
            _ExtentX        =   2037
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Mandatory       =   -1  'True
            Label           =   "Internal Terms"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   1155
         End
         Begin ITGControls.ITGTextBox txtEWTRate 
            Height          =   285
            Left            =   3555
            TabIndex        =   51
            Top             =   2730
            Width           =   3255
            _ExtentX        =   5530
            _ExtentY        =   503
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Mandatory       =   -1  'True
            Label           =   "EWT Rate"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1800
            TextBoxWidth    =   1395
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtEWTType 
            Height          =   285
            Left            =   1695
            TabIndex        =   53
            Tag             =   "cboType"
            Top             =   2760
            Width           =   1185
            _ExtentX        =   1984
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Mandatory       =   -1  'True
            Label           =   "Transaction Type"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   1125
         End
         Begin ITGControls.ITGCheckBox chkSupplier 
            Height          =   300
            Left            =   5760
            TabIndex        =   56
            Top             =   510
            Width           =   1035
            _ExtentX        =   1826
            _ExtentY        =   529
            BackColor       =   16243138
            Caption         =   "Individual"
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
         End
         Begin ITGControls.ITGCheckBox chkCustomer 
            Height          =   300
            Left            =   4485
            TabIndex        =   57
            Top             =   510
            Width           =   1035
            _ExtentX        =   1826
            _ExtentY        =   529
            BackColor       =   16243138
            Caption         =   "Company"
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
         End
         Begin VB.Label lblEwtDesc 
            BackStyle       =   0  'Transparent
            Caption         =   "EWT Description"
            Height          =   585
            Left            =   1665
            TabIndex        =   55
            Top             =   3150
            Width           =   5145
         End
         Begin VB.Label Label6 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "EWT Type"
            Height          =   195
            Left            =   240
            TabIndex        =   54
            Top             =   2775
            Width           =   735
         End
         Begin VB.Label Label3 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "* Country / Zip"
            Height          =   195
            Left            =   225
            TabIndex        =   46
            Top             =   1830
            Width           =   1080
         End
         Begin VB.Label Label2 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Area Type"
            Height          =   195
            Left            =   7035
            TabIndex        =   45
            Top             =   840
            Width           =   750
         End
         Begin VB.Label Label1 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Supplier Type"
            Height          =   195
            Left            =   7065
            TabIndex        =   44
            Top             =   525
            Width           =   975
         End
      End
   End
   Begin MSComctlLib.StatusBar sbRS 
      Align           =   2  'Align Bottom
      Height          =   255
      Left            =   0
      TabIndex        =   35
      Top             =   8295
      Width           =   10770
      _ExtentX        =   18997
      _ExtentY        =   450
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   2
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
      EndProperty
   End
   Begin VB.Label lblDetails 
      BackColor       =   &H00F7D9C2&
      Caption         =   "Supplier Type"
      ForeColor       =   &H00000000&
      Height          =   255
      Left            =   180
      TabIndex        =   48
      Top             =   555
      Visible         =   0   'False
      Width           =   9000
   End
   Begin VB.Label lblHeader 
      BackColor       =   &H00F7D9C2&
      Caption         =   "Supplier ID - Supplier Name"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   375
      Left            =   180
      TabIndex        =   47
      Top             =   195
      Width           =   9165
   End
   Begin VB.Image imgLogo 
      BorderStyle     =   1  'Fixed Single
      Height          =   930
      Left            =   9435
      Stretch         =   -1  'True
      Top             =   0
      Width           =   1125
   End
   Begin VB.Shape Shape1 
      BorderColor     =   &H00404040&
      Height          =   975
      Left            =   0
      Top             =   0
      Width           =   9360
   End
End
Attribute VB_Name = "frmMaintCustomerSupplier"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'IT Group Inc. 2005.09.23

Option Explicit

'Object variables





'Recordset variables
Private WithEvents rsHeader As ADODB.Recordset
Attribute rsHeader.VB_VarHelpID = -1
Private rsSAddress As ADODB.Recordset
Private rsSProduct As ADODB.Recordset

Private rsSHistory As Recordset

'ADO Connection variables

Private connHeader As ADODB.Connection
Private connSAddress As ADODB.Connection
Private connSProduct As ADODB.Connection

'used for canvass module
Public sTmpSCode As String

'Form mode enumeration
Public Enum eSupplierMode
    Normal
    AddNewEdit
    Find
End Enum
Public Mode As eSupplierMode

'Other declaration
Public dtgName As String
Public sBit As String
Private vBM As Variant 'Recordset bookmark variable
Private nInterval As Integer

'Security Acess Level variables
Public lACNew As Boolean
Public lACEdit As Boolean
Public lACDelete As Boolean
Public lACPost As Boolean
Public lACCancel As Boolean
Public lACPrint As Boolean



Private Sub cboEwtType_Click()
    txtEWTType = Trim(cboEwtType)
    txtEWTRate = GetValueFrTable("cValue", "PARAMETER_USER", "cParamName = '" & Trim(cboEwtType) & "' and cCompanyID = '" & Trim(COID) & "' and cType = 'ATCCode'")
End Sub

Private Sub cboSCountry_Click()
    txtSCountry = Trim(cboSCountry)
End Sub

Private Sub cboSCountry_KeyPress(KeyAscii As Integer)
    SendKeysTab KeyAscii
End Sub

Private Sub cboSCountryDetails_Click()
    dtgSAddress.Columns(3) = cboSCountryDetails
End Sub

'&&&&&&&&&START
Private Sub cboSCountryDetails_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        dtgSAddress.Columns(3) = cboSCountryDetails
        cboSCountryDetails.Visible = False
        dtgSAddress.Col = 4
        dtgSAddress.Columns(4) = ""
        dtgSAddress.SetFocus
    ElseIf KeyCode = vbKeyEscape Then
        cboSCountryDetails.Visible = False
        dtgSAddress.Col = 3
        dtgSAddress.SetFocus
    End If
End Sub

Private Sub cboSCountryDetails_LostFocus()
    cboSCountryDetails.Visible = False
End Sub

Private Sub cboSPD_Click()
    rsSProduct!cPDCode = GetValueFrTable("cClassCode", "CLASSIFICATION", "cDescription = '" & Trim(cboSPD) & "' AND cType = 'PD'")
    dtgSProduct.Columns(4) = cboSPD
End Sub

Private Sub cboSPD_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        rsSProduct!cPDCode = GetValueFrTable("cClassCode", "CLASSIFICATION", "cDescription = '" & Trim(cboSPD) & "' AND cType = 'PD'")
        dtgSProduct.Columns(4) = cboSPD
        cboSPD.Visible = False
        TBNewLine
        dtgSProduct.LeftCol = 0
    ElseIf KeyCode = vbKeyEscape Then
        cboSPD.Visible = False
        dtgSProduct.Col = 4
        dtgSProduct.SetFocus
    End If
End Sub

Private Sub cboSPD_LostFocus()
    cboSPD.Visible = False
End Sub

Private Sub cboSTerms_Click()
    txtSTerms = Trim(cboSTerms)
End Sub

Private Sub cboSTerms_KeyPress(KeyAscii As Integer)
    SendKeysTab KeyAscii
End Sub

Private Sub cboSType_Click()
    txtSType = Trim(cboSType)
End Sub

Private Sub cboSType_KeyPress(KeyAscii As Integer)
    SendKeysTab KeyAscii
End Sub

Private Sub cboType_Click()
    txtType = Trim(cboType)
End Sub

Private Sub cboType_KeyPress(KeyAscii As Integer)
    SendKeysTab KeyAscii
End Sub

'Call pick list module

Private Sub cmdPickSDept_Click()
    If lPickListActive Then Exit Sub
    frmITGPicker.zType = QSecDepartment
    frmITGPicker.Show vbModal
    txtSDepartment = frmITGPicker.zCode
    If Trim(txtSDepartment) <> "" Then SendKeys "{Tab}"
End Sub

Private Sub cmdSHistory_Click()
    
    If Not IsDate(dtbSFrom.Text) Then
        MsgBox "Please input date parameter.", vbInformation, "ComUnion"
        dtbSFrom.SetFocus
        Exit Sub
    ElseIf Not IsDate(dtbSTo.Text) Then
        MsgBox "Please input date parameter.", vbInformation, "ComUnion"
        dtbSTo.SetFocus
        Exit Sub
    End If
    
    Set rsSHistory = Nothing
    Set rsSHistory = New Recordset
    Set dtgSHistory.DataSource = Nothing
    dtgSHistory.Refresh
    
    sSQL = "SELECT * FROM V_History_Supplier WHERE cCode = '" & Trim(txtCode) & "' " & _
            "AND dDate BETWEEN '" & Trim(dtbSFrom.Text) & "' AND '" & Trim(dtbSTo.Text) & "'"
    rsSHistory.Open sSQL, cn, adOpenForwardOnly, adLockReadOnly
    
    Set dtgSHistory.DataSource = rsSHistory

End Sub

Private Sub dtgList_HeadClick(ByVal ColIndex As Integer)
On Error Resume Next
    SortGrid dtgList, ColIndex, rsHeader
End Sub

'Private Sub dtgList_HeadClick(ByVal ColIndex As Integer)
'    SortGrid dtgList, ColIndex, rsHeader
'End Sub

Private Sub dtgSHistory_HeadClick(ByVal ColIndex As Integer)
On Error Resume Next
    SortGrid dtgSHistory, ColIndex, rsSHistory
End Sub

Private Sub dtgSHistory_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub

Private Sub dtgSProduct_ButtonClick(ByVal ColIndex As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 4
            MoveCombo cboSPD, dtgSProduct, dtgSProduct.Columns(3)
            ComboLoadValue cboSPD, Trim(dtgSProduct.Columns(3).Text)
            cboSPD.SetFocus
    End Select
End Sub

'Set the datagrid as active control
Private Sub dtgSProduct_Click()
    If Mode = AddNewEdit Then dtgName = dtgSProduct.Name
End Sub

Private Sub dtgSProduct_Error(ByVal DataError As Integer, Response As Integer)
    If Mode <> AddNewEdit Then
        Response = 0
        Exit Sub
    End If
    If DataError = 7007 Then
        MsgBox "Type mismatch", vbExclamation, "ComUnion"
    ElseIf DataError = 13 Then
        MsgBox "Type mismatch", vbExclamation, "ComUnion"
    End If
    Response = 0
End Sub

Private Sub dtgSProduct_GotFocus()
    dtgName = dtgSProduct.Name
End Sub

Private Sub dtgSProduct_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub

Private Sub dtgSProduct_KeyPress(KeyAscii As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If rsSProduct.RecordCount = 0 Then Exit Sub
    
    If KeyAscii = 39 Then KeyAscii = 0 'Apostrophe {'}
    
    If KeyAscii = 13 Then
        Select Case dtgSProduct.Col
            Case 4
                If Not cboSPD.Visible Then dtgSProduct_ButtonClick 4
            Case Else
                SendKeys "{Tab}"
        End Select
    Else
        KeyAscii = Asc(UCase(Chr(KeyAscii))) 'All Upper Case String
    End If
End Sub

'Right click menu popup
Private Sub dtgSProduct_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = dtgSProduct.Name
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub

Private Sub dtgSAddress_ButtonClick(ByVal ColIndex As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 3
            MoveCombo cboSCountryDetails, dtgSAddress, dtgSAddress.Columns(3)
            ComboLoadValue cboSCountryDetails, Trim(dtgSAddress.Columns(3).Text)
            cboSCountryDetails.SetFocus
    End Select
End Sub

'Set the datagrid as active control
Private Sub dtgSAddress_Click()
    If Mode = AddNewEdit Then dtgName = dtgSAddress.Name
End Sub

Private Sub dtgSAddress_Error(ByVal DataError As Integer, Response As Integer)
    If Mode <> AddNewEdit Then
        Response = 0
        Exit Sub
    End If
    If DataError = 7007 Then
        MsgBox "Type mismatch", vbExclamation, "ComUnion"
    ElseIf DataError = 13 Then
        MsgBox "Type mismatch", vbExclamation, "ComUnion"
    End If
    Response = 0
End Sub

Private Sub dtgSAddress_GotFocus()
    dtgName = dtgSAddress.Name
End Sub

Private Sub dtgSAddress_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub

Private Sub dtgSAddress_KeyPress(KeyAscii As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If rsSAddress.RecordCount = 0 Then Exit Sub
    
    If KeyAscii = 39 Then KeyAscii = 0 'Apostrophe {'}
    
    If KeyAscii = 13 Then
        Select Case dtgSAddress.Col
            Case 3
                If Not cboSCountryDetails.Visible Then dtgSAddress_ButtonClick 3
            Case 7
                TBNewLine
                dtgSAddress.LeftCol = 0
            Case Else
                SendKeys "{Tab}"
        End Select
    Else
        KeyAscii = Asc(UCase(Chr(KeyAscii))) 'All Upper Case String
    End If
End Sub

'Right click menu popup
Private Sub dtgSAddress_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = dtgSAddress.Name
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub
 
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Dim iKey As Integer
    iKey = ToolbarIndex(KeyCode, Shift)
    If iKey <> 0 Then
        If ITGLedgerMain.tbrMain.Buttons(iKey).Enabled = True Then
            ToolbarFunction iKey
        End If
    End If
End Sub

'Set Your Object
Private Sub Form_Load()
        
    Set FrmName = Me
    FormSetup
    
    AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'MF27'")
    
    Set rsHeader = New ADODB.Recordset
    Set rsSAddress = New ADODB.Recordset
    Set rsSProduct = New ADODB.Recordset
    
    
    'CallComboBox Values
    Call LoadComboValues(cboSCountry, "cValue", "PARAMETER_SYSTEM", "WHERE cType = 'COUNTRY'")
    Call LoadComboValues(cboSCountryDetails, "cValue", "PARAMETER_SYSTEM", "WHERE cType = 'COUNTRY'")
    Call LoadComboValues(cboSPD, "cDescription", "CLASSIFICATION", "WHERE cType = 'PD' AND cCompanyID = '" & Trim(COID) & "'")
    Call LoadComboValues(cboSTerms, "cParamName", "PARAMETER_USER", "WHERE cType = 'TERMS' AND cCompanyID = '" & Trim(COID) & "'", "nOrder")
    Call LoadComboValues(cboType, "cValue", "PARAMETER_SYSTEM", "WHERE cType = 'CUSTTYPE'")
    Call LoadComboValues(cboEwtType, "cParamname", "Parameter_user", "where ctype = 'ATCCODE'", "nOrder")
    
    FormLocking True
    FormSearch True
    SearchObj True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    BitVisible ITGLedgerMain.tbrMain, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    
    imgLogo.Picture = ITGLedgerMain.Picture1.Picture
    Mode = Find
    txtCode.Locked = False
    
   
    
End Sub

'Activate your Toolbar Mode
Private Sub Form_Activate()
    TBBitReload
End Sub

'Release your Object
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
    If Mode = AddNewEdit Then
        MsgBox "Unable to close. You are in Add/New/Edit mode." & vbCr & _
            " Must Save or Undo", vbCritical, Me.Caption
        Cancel = True
        Exit Sub
    End If
    
    CloseMenuTab ITGLedgerMain
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True
    BitVisible ITGLedgerMain.tbrMain
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = False
    
    
    
    
    
    Set rsHeader = Nothing
    Set rsSAddress = Nothing
    Set rsSProduct = Nothing
    Set rsSHistory = Nothing
    Set connHeader = Nothing
    Set connSAddress = Nothing
    Set connSProduct = Nothing
    
    Set frmMaintCustomerSupplier = Nothing

    lCloseWindow = True
    
'    'oForm(Me.Tag).Mode = 1
'    'oForm(Me.Tag).Tag = Me.Tag
End Sub

'Add new record to the recordset
Public Sub TBNew()
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    txtCode.BackColor = &HE0FFFF
    Mode = AddNewEdit
    
    If rsHeader.State <> adStateOpen Then
        OpenNewConnection connHeader
        OpenNewConnection connSAddress
        OpenNewConnection connSProduct
        OpenRecordsetWithCN rsSProduct, "*", "CLIENT_SUPPLIER_ITEM", connSProduct, "WHERE 1 = 0"
        OpenRecordsetWithCN rsSAddress, "*", "CLIENT_SUPPLIER_ADD", connSAddress, "WHERE 1 = 0"
        OpenRecordsetWithCN rsHeader, "*", "CLIENT_SUPPLIER", connHeader, "WHERE 1 = 0"
        SetDataSource
        SetDataField
    Else
        vBM = rsHeader.Bookmark
    End If
        
    rsHeader.AddNew
    rsHeader!cCompanyID = COID
    rsHeader!cSupplierType = "Regular"
    rsHeader!cType = "Local"
    rsHeader!cCountry = "PHILIPPINES"
    
    'NOTE : this code is for auto increment (Under Construct)
    'NOTE : In table SYSTEM_OPTION you need to create cCode = 'AUTO_NUMBER_SPL'
    
    'rsHeader!cCode = Format(CDbl(GetValueFrTable("cValue", "SYSTEM_OPTION", "cCode = 'AUTO_NUMBER_SPL'", True)) + 1, "0000")
    '-----------------------------------------------------------------------------------------------------------------------
    
    
    txtCode.Locked = True
    
 '   rsHeader!lCustomer = False
 '   rsHeader!lSupplier = False
    
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    cmdSHistory.Enabled = False
    SSTab2.ActiveTab = 0
    txtCode.SetFocus
    
End Sub

'Undo all changes to the recordset
Public Sub TBUndoAll()
On Error GoTo ErrorHandler

    Mode = Normal
    
    If rsHeader.Status = adRecNew Then TBUndoCurrent
    
    rsHeader.CancelBatch adAffectAll
    rsSProduct.CancelBatch adAffectAll
    rsSAddress.CancelBatch adAffectAll
    
    UnbindControls
    
    If rsHeader.RecordCount <> 0 Then rsHeader.Bookmark = vBM
    
    Set FrmName = Me
    FormLocking True
    cmdSHistory.Visible = True
    
    If rsHeader.RecordCount <> 0 Then
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True
    Else
        RSZero
        Mode = Find
    End If
    
    sbRS.Panels(2) = ""

    SetDataSource
    SetDataField

ErrorHandler:
    cboSCountryDetails.Visible = False
    cboSPD.Visible = False
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then 'Operation was cancelled. (Error returned by ITGDateBox)
        TBUndoAll
    End If

End Sub

'Undo changes on the current record
Public Sub TBUndoCurrent()
On Error GoTo ErrorHandler

    GetChild
    If rsHeader.Status = adRecNew Then
        rsSAddress.CancelBatch adAffectAll
        rsSProduct.CancelBatch adAffectAll
        rsHeader.CancelUpdate
    Else
        rsHeader.CancelBatch adAffectCurrent
        rsSAddress.CancelBatch adAffectAll
        rsSProduct.CancelBatch adAffectAll
    End If
   
    If rsHeader.RecordCount = 0 Then RSZero
        
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then 'Operation was cancelled. (Error returned by ITGDateBox)
        TBUndoCurrent
    End If

End Sub

'Save all changes
Public Sub TBSave()
Dim OKUpdate As Boolean
'On Error GoTo ErrHandler

    'Audit Trail
    lBoolean = False
    If rsHeader.Status = adRecNew Then lBoolean = True
    
    If Not MandatoryOK Then Exit Sub
    
    OKUpdate = False
    cn.BeginTrans
    connHeader.BeginTrans
    connSAddress.BeginTrans
    connSProduct.BeginTrans
        
    rsHeader.UpdateBatch adAffectAll
    rsSAddress.UpdateBatch adAffectAll
    rsSProduct.UpdateBatch adAffectAll
    
    cn.CommitTrans
    connHeader.CommitTrans
    connSAddress.CommitTrans
    connSProduct.CommitTrans
    OKUpdate = True
    
    Set FrmName = Me
    FormLocking True
    cmdSHistory.Enabled = True
    dtbSFrom.Enabled = True
    dtbSTo.Enabled = True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True
    Mode = Normal
    
    cn.Execute "UPDATE SYSTEM_OPTION SET cValue = '" & rsHeader!cCode & "' WHERE cCode = 'AUTO_NUMBER_SPL'"
    
    MsgBox "Record/s successfully saved.", vbInformation, "ComUnion"
   ' SSTab2.TabEnabled(0) = True
   ' SSTab2.TabEnabled(1) = True
   SetDataSource
   SetDataField
   
    'Audit trail
    UpdateLogFile "Supplier", Trim(txtCode), IIf(lBoolean, "Inserted", "Updated")
    
    lblHeader = rsHeader!cCode & " - " & rsHeader!cName & ""
    'lblDetails = rsHeader!cAddress & ""
    sbRS.Panels(2) = ""
    If lBoolean Then cn.Execute "update CANVASS_T set cCode = '" & Trim(rsHeader!cCode) & "'," & _
                "cSupType = 'Existing', cName = ' " & Trim(rsHeader!cName) & "'where cCode ='" & Trim(sTmpSCode) & "' and cCompanyID = '" & Trim(COID) & "'"
    
ErrHandler:
    cboSCountryDetails.Visible = False
    cboSPD.Visible = False
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        OKUpdate = True
        cn.RollbackTrans
        connHeader.RollbackTrans
        connSAddress.RollbackTrans
        connSProduct.RollbackTrans
        MsgBox "Record cannot be updated. Some values may have been changed by other user/s since last read." & vbCr & _
                "Records will be automatically refreshed. All changes made to the record will be gone upon refresh.", vbInformation, "ComUnion"
        vBookMark = rsHeader.Bookmark
        UnbindControls
        rsHeader.Requery
        rsSAddress.Requery
        rsSProduct.Requery
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True
        Mode = Normal
        If rsHeader.RecordCount <> 0 Then
            Set FrmName = Me
            FormLocking True
            cmdSHistory.Enabled = True
            dtbSFrom.Enabled = True
            dtbSTo.Enabled = True
            SetDataField
            SetDataSource
            rsHeader.Bookmark = vBookMark
        Else
            RSZero
        End If
    End If
    
    If Not OKUpdate Then
        MsgBox "Transaction update failed.", vbInformation, "ComUnion"
        cn.RollbackTrans
        connHeader.RollbackTrans
        connSAddress.RollbackTrans
        connSProduct.RollbackTrans
        ErrorLog err.Number, err.Description, Me.Name 'Error log
    End If
    
End Sub

'Sets the form & recorset to add/edit mode
Public Sub TBEdit()
    Mode = AddNewEdit
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    cmdSHistory.Enabled = False
    txtCode.Locked = True
    SSTab2.ActiveTab = 0
    txtName.SetFocus
    vBM = rsHeader.Bookmark
End Sub

'Delete record
Public Sub TBDelete()
Dim Code As String
On Error GoTo ErrorHandler
    
    sID = Trim(txtCode)
    
    If rsHeader.RecordCount = 0 Then Exit Sub
    
    Dim rs As New ADODB.Recordset
    Set rs = Nothing
    rs.Open "SELECT A.cCode FROM VClient A, CLIENT_SUPPLIER B WHERE A.cCompanyID = B.cCompanyID and A.cCode = '" & Trim(sID) & "' ", cn, adOpenStatic

    If rs.RecordCount <> 0 Then
        MsgBox "Unable to delete. Referenced by other transactions.", vbExclamation, "ALERT"
        rs.Close
        GoTo ErrorHandler
    End If
    
    If MsgBox("Are you sure you want to delete this record?", vbQuestion + vbYesNo, "ComUnion") = vbNo Then Exit Sub
    
    Code = Trim(rsHeader!cCode)
    
    GetChild
    If rsSAddress.RecordCount <> 0 Then
        rsSAddress.MoveFirst
        Do Until rsSAddress.RecordCount = 0
            rsSAddress.Delete adAffectCurrent
            If rsSAddress.RecordCount <> 0 Then rsSAddress.MoveFirst
        Loop
    End If
    If rsSProduct.RecordCount <> 0 Then
        rsSProduct.MoveFirst
        Do Until rsSProduct.RecordCount = 0
            rsSProduct.Delete adAffectCurrent
            If rsSProduct.RecordCount <> 0 Then rsSProduct.MoveFirst
        Loop
    End If
    
    'Audit trail
    UpdateLogFile "Supplier", Trim(txtCode), "Deleted"

    rsHeader.Delete adAffectCurrent
    
    rsSAddress.UpdateBatch adAffectAll
    rsSProduct.UpdateBatch adAffectAll
    rsHeader.UpdateBatch adAffectAll
    

    
    TBPrevRec

    Mode = Normal
    
    If rsHeader.RecordCount = 0 Then
        RSZero
    End If

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Or err.Number = -2147217887 Then
        cn.Execute "DELETE CLIENT_SUPPLIER_ITEM WHERE cCode = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE CLIENT_SUPPLIER_ADD WHERE cCode = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE CLIENT_SUPPLIER WHERE cCode = '" & sID & "' AND cCompanyID = '" & COID & "'"
        Resume Next
    End If

End Sub

'Search using the frmITGSearch
Public Sub TBFind()
    Mode = Normal
    txtCode.Locked = True
    frmITGSearch.Show
End Sub

'Search using the recordset primary key
Public Sub TBFindPrimary()
Dim sTemp As String
If Mode = Find Then
    FormWaitShow App.Path & "\Transmit.avi", "Loading data . . ."
        
    OpenNewConnection connHeader
    OpenNewConnection connSAddress
    OpenNewConnection connSProduct
    
    Set rsHeader = Nothing
    Set rsSAddress = Nothing
    Set rsSProduct = Nothing
    Set rsHeader = New ADODB.Recordset
    Set rsSAddress = New ADODB.Recordset
    Set rsSProduct = New ADODB.Recordset
            
    sTemp = Trim$(GetSearchString)
    If sTemp = "ERROR" Then
        MsgBox "Only Allows A - Z, 0 - 9, '.', ',' and %(wildcard)", vbExclamation, ""
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
        txtCode.Locked = False
        txtCode.SetFocus
        Exit Sub
    End If
            
    OpenRecordsetWithCN rsSProduct, "*", "CLIENT_SUPPLIER_ITEM", connSProduct
    OpenRecordsetWithCN rsSAddress, "*", "CLIENT_SUPPLIER_ADD", connSAddress
    OpenRecordsetWithCN rsHeader, "*", "CLIENT_SUPPLIER", connHeader, IIf(sTemp = "", "", " WHERE " & sTemp)
                 
    Set FrmName = Me
    FormLocking True
    cmdSHistory.Enabled = True
    dtbSFrom.Enabled = True
    dtbSTo.Enabled = True
            
    If rsHeader.RecordCount = 0 Then
        FormWaitHide
        MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
        RSZero
        FormSearch True
        SearchObj True
        Mode = Find
        Exit Sub
    End If
    SetDataSource
    SetDataField
    txtCode.BackColor = &HE0FFFF
    Mode = Normal
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True

    FormWaitHide
Else
    RSZero
    FormSearch True
    SearchObj True
    Mode = Find
    
   
    
End If

End Sub

'Reload menu buttons (do not delete this sub)
Public Sub TBBitReload()
    BitVisible ITGLedgerMain.tbrMain, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
    Set FrmName = Me
'    dtgName = dtgMSLimit.Name
End Sub

'Close active window
Public Sub TBCloseWindow()
    Unload Me
End Sub

'Move first
Public Sub TBFirstRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveFirst rsHeader
    

End Sub

'Move previous
Public Sub TBPrevRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MovePrevious rsHeader
    


End Sub

'Move next
Public Sub TBNextRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveNext rsHeader
    
     
End Sub

'Move last
Public Sub TBLastRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveLast rsHeader
    

End Sub

'Add new line to the detail recordset
Public Sub TBNewLine()
    
    If rsHeader!cCode = "" Then Exit Sub

    If dtgName = "dtgSAddress" Then
        rsSAddress.AddNew
        rsSAddress!cCompanyID = COID
        rsSAddress!cCode = Trim(txtCode)
        GetChild
        dtgSAddress.SetFocus
        dtgSAddress.Col = 0
        rsSAddress.MoveLast
    ElseIf dtgName = "dtgSProduct" Then
        rsSProduct.AddNew
        rsSProduct!cCompanyID = COID
        rsSProduct!cCode = Trim(txtCode)
        GetChild
        dtgSProduct.SetFocus
        dtgSProduct.Col = 0
        rsSProduct.MoveLast
    End If
    
End Sub

'Delete line in the detail recordset
Public Sub TBDeleteLine()
On Error GoTo ErrorHandler

    If dtgName = "dtgSAddress" Then
        If rsSAddress.RecordCount = 0 Then Exit Sub
        vBookMark = dtgSAddress.Bookmark
        GetChild
        dtgSAddress.Bookmark = vBookMark
        rsSAddress.Delete adAffectCurrent
    ElseIf dtgName = "dtgSProduct" Then
        If rsSProduct.RecordCount = 0 Then Exit Sub
        vBookMark = dtgSProduct.Bookmark
        GetChild
        dtgSProduct.Bookmark = vBookMark
        rsSProduct.Delete adAffectCurrent
    End If
    GetChild
    
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

'Undo all
Public Sub TBUndoLineAll()
On Error GoTo ErrorHandler

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If
    
End Sub

'Undo current line
Public Sub TBUndoLineCurrent()
    MsgBox "Unavailable on " & Me.Name
End Sub

'Post current record
Public Sub TBPostRecord()
    MsgBox "Unavailable on " & Me.Name
End Sub

'Cancel current record
Public Sub TBCancelRecord()
    MsgBox "Unavailable on " & Me.Name
End Sub

'Print
Public Sub TBPrintRecord()
    MsgBox "Unavailable on " & Me.Name
End Sub

'Sets the data source of the controls
Sub SetDataSource()

    Set FrmName = Me
    BindControls rsHeader

    Set dtgSAddress.DataSource = rsSAddress
    Set dtgSProduct.DataSource = rsSProduct
    Set dtgList.DataSource = rsHeader

    Set txtName.DataSource = rsHeader
    Set txtCode.DataSource = rsHeader
    Set txtSType.DataSource = rsHeader
    Set txtSAddress.DataSource = rsHeader
    Set txtSCity.DataSource = rsHeader
    Set txtSState.DataSource = rsHeader
    Set txtSCountry.DataSource = rsHeader
    Set txtSZip.DataSource = rsHeader
    Set txtSPhone.DataSource = rsHeader
    Set txtSFax.DataSource = rsHeader
    Set txtSInternet.DataSource = rsHeader
    Set txtSEMail.DataSource = rsHeader
    Set txtSContact.DataSource = rsHeader
    Set txtSDescription.DataSource = rsHeader
    Set txtSDepartment.DataSource = rsHeader
    Set txtSCL.DataSource = rsHeader
    Set txtSTerms.DataSource = rsHeader
    Set txtSTIN.DataSource = rsHeader
    Set txtType.DataSource = rsHeader
    Set txtEWTType.DataSource = rsHeader
    Set txtEWTRate.DataSource = rsHeader
   
End Sub
    
'Sets the data field for every bounded controls
Sub SetDataField()
    With rsHeader
        txtCode.DataField = !cCode
        txtName.DataField = !cName
        txtSType.DataField = !cType
        txtSAddress.DataField = !cAddress
        txtSCity.DataField = !cCity
        txtSState.DataField = !cState
        txtSCountry.DataField = !cCountry
        txtSZip.DataField = !cZip
        txtSPhone.DataField = !cTel
        txtSFax.DataField = !cFax
        txtSInternet.DataField = !cInternet
        txtSEMail.DataField = !cEMail
        txtSContact.DataField = !cContact
        txtSDescription.DataField = !cDescription
        txtSDepartment.DataField = !cDepartment
        txtSCL.DataField = !nLimit
        txtSTerms.DataField = !cTerm
        txtSTIN.DataField = !cTIN
        txtType.DataField = !cSupplierType
        txtEWTType.DataField = !cEwtType
        txtEWTRate.DataField = !nEWTRATE
        'Add code
        chkCustomer.DataField = !lCompany
        chkSupplier.DataField = !lIndividual
    End With
End Sub

'Private Sub lvwList_DblClick()
'    'If lvwList.ListItems.Count = 0 Then Exit Sub
'    Set rs = New Recordset
'    Set rs = rsHeader.Clone
'    rs.Find "cCode = '" & Trim(lvwList.SelectedItem.Text) & "'"
'    rsHeader.Bookmark = rs.Bookmark
'    Set rs = Nothing
'End Sub

Private Sub rsHeader_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
On Error GoTo ErrorHandler
    
    If Not (rsHeader.EOF) Or Not (rsHeader.BOF) Then
        lblHeader = rsHeader!cCode & " - " & rsHeader!cName & ""
        sbRS.Panels(1) = "Record: " & IIf((rsHeader.AbsolutePosition = -2), "0", rsHeader.AbsolutePosition) & "/" & rsHeader.RecordCount

        If rsHeader.Status <> adRecNew Then
            txtCode.Locked = True
        Else: txtCode.Locked = False
        End If

        If Mode = AddNewEdit Then
            Select Case rsHeader.Status
                Case adRecNew
                    sbRS.Panels(2) = "New"
                Case adRecModified
                    sbRS.Panels(2) = "Modified"
                Case Else
                    sbRS.Panels(2) = ""
            End Select
        Else: sbRS.Panels(2) = ""
        End If
                
        GetChild
        ShowSupplierBalance
           
    Else
        lblHeader = "Supplier ID - Supplier Name"
        sbRS.Panels(1) = "Record: 0/0"
        sbRS.Panels(2) = ""
        txtCode.Locked = False
    End If

    If Mode = AddNewEdit Then
        dtgSAddress.Refresh
        dtgSProduct.Refresh
    End If

    Set dtgSHistory.DataSource = Nothing
    dtgSHistory.Refresh
    dtbSFrom.Text = "__/__/____"
    dtbSTo.Text = "__/__/____"

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If
End Sub

'- NOTE: This code is under construct----

'Private Sub SSTab2_Click()
'    nInterval = 30
'    Select Case SSTab2.ActiveTab
'        Case 0
'        Case 1
'        Case 2
'            Call Show_Report
'    End Select
'End Sub

'----------------------------------------

Private Sub Timer1_Timer()
    If Mode = AddNewEdit Then
        SSTab2.TabEnabled(1) = False
    Else
        SSTab2.TabEnabled(1) = True
    End If
End Sub


Private Sub txtCode_LostFocus()
    'Does Code Already exists
    If Mode = AddNewEdit Then
        If Trim(txtCode) = "" Then
            MsgBox "Empty primary input.", vbInformation, "ComUnion"
            If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
            txtCode.SetFocus
        Else
            If rsHeader.Status <> adRecNew Then Exit Sub
            txtCode = Trim(txtCode)
            If IDExisting(rsHeader, "cCode", "CLIENT_SUPPLIER", Trim(rsHeader!cCode)) Then
                MsgBox "Supplier ID already exists.", vbInformation, "ComUnion"
                If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
                txtCode.SetFocus
            End If
        End If
    End If
End Sub



Private Sub txtEWTType_Change()
    If Trim(txtEWTType) <> "" Or txtEWTType <> vbNullString Then
        cboEwtType = Trim(txtEWTType)
    Else
        cboEwtType.ListIndex = -1
    End If
    txtEWTRate.Text = GetValueFrTable("cValue", "parameter_user", "cParamName = '" & Trim(txtEWTType) & "'")
    lblEwtDesc.Caption = GetValueFrTable("cDesc", "parameter_user", "cParamName = '" & Trim(txtEWTType) & "'")
End Sub


Private Sub txtType_Change()
    If Trim(txtType) <> "" Or txtType <> vbNullString Then
        cboType = Trim(txtType)
    Else
        cboType.ListIndex = -1
    End If
End Sub

Private Sub txtSCountry_Change()
    If Trim(txtSCountry) <> "" Or txtSCountry <> vbNullString Then
        cboSCountry = Trim(txtSCountry)
    Else
        cboSCountry.ListIndex = -1
    End If
End Sub

Private Sub txtSTerms_Change()
    If Not Mode <> AddNewEdit Then Exit Sub
    If Trim(txtSTerms) <> "" Or txtSTerms <> vbNullString Then
        cboSTerms = Trim(txtSTerms)
    Else
        cboSTerms.ListIndex = -1
    End If
End Sub

Private Sub txtSType_Change()
    If Trim(txtSType) <> "" Or txtSType <> vbNullString Then
        cboSType = Trim(txtSType)
    Else
        cboSType.ListIndex = -1
    End If
End Sub

'Check if all mandatory fields are complete
Function MandatoryOK() As Boolean
    
    MandatoryOK = True

    If Trim(txtCode) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Supplier ID' is mandatory. Null value is not allowed.", vbInformation, "ComUnion"
        txtCode.SetFocus
        Exit Function
    End If
    
    If rsHeader.Status = adRecNew Then
        If IDExisting(rsHeader, "cCode", "CLIENT_SUPPLIER", Trim(rsHeader!cCode)) Then
            MandatoryOK = False
            MsgBox "Supplier ID already exists.", vbInformation, "ComUnion"
            txtCode.SetFocus
            Exit Function
        End If
    End If

    If Trim(txtName) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Supplier Name' is mandatory. Null value is not allowed", vbInformation, "ComUnion"
        txtName.SetFocus
        Exit Function
    End If
    
    'mandatory fields for supplier
    If Trim(txtSAddress) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Address' is mandatory. Null value is not allowed", vbInformation, "ComUnion"
        'SSTab3.Tab = 1
        txtSAddress.SetFocus
        Exit Function
    ElseIf Trim(txtSCountry) = "" Then
        MandatoryOK = False
        'SSTab3.Tab = 1
        MsgBox "Field 'Country' is mandatory. Null value is not allowed", vbInformation, "ComUnion"
        cboSCountry.SetFocus
        Exit Function
    ElseIf Trim(txtSTerms) = "" Then
        MandatoryOK = False
        'SSTab3.Tab = 1
        MsgBox "Field 'Terms' is mandatory. Null value is not allowed", vbInformation, "ComUnion"
        cboSTerms.SetFocus
        Exit Function
    ElseIf Trim(txtSTIN) = "" Then
        MandatoryOK = False
        'SSTab3.Tab = 1
        MsgBox "Field 'TIN' is mandatory. Null value is not allowed", vbInformation, "ComUnion"
        cboSTerms.SetFocus
        Exit Function
    End If

    GetChild

    If rsSAddress.RecordCount <> 0 Then rsSAddress.MoveFirst
    Do Until rsSAddress.EOF
        If rsSAddress.Status = (adRecNew) Or rsSAddress.Status = (adRecModified) Then
            If IsNull(rsSAddress!cAddress) Then
                rsSAddress.Delete
            ElseIf Trim(rsSAddress!cAddress) = "" Then
                rsSAddress.Delete
            Else
                rsSAddress.MoveNext
            End If
        Else
            rsSAddress.MoveNext
        End If
    Loop
    
    If rsSProduct.RecordCount <> 0 Then rsSProduct.MoveFirst
    Do Until rsSProduct.EOF
        If rsSProduct.Status = (adRecNew) Or rsSProduct.Status = (adRecModified) Then
            If IsNull(rsSProduct!cItemNo) Then
                rsSProduct.Delete
            ElseIf Trim(rsSProduct!cItemNo) = "" Then
                rsSProduct.Delete
            Else
                rsSProduct.MoveNext
            End If
        Else
            rsSProduct.MoveNext
        End If
    Loop
    
    GetChild
    
End Function

'Filter detail recordset to header's primary
Private Sub GetChild()
On Error Resume Next
    rsSAddress.Filter = "cCode = '" & Trim(rsHeader!cCode) & "'"
    rsSProduct.Filter = "cCode = '" & Trim(rsHeader!cCode) & "'"
End Sub
Private Function GetSearchString() As String
On Error GoTo ErrorHandler
Dim sWhere As String

    GetSearchString = True

    If Trim$(txtCode.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cCode LIKE '" & Trim$(txtCode.Text) & "%'"
    End If

    If Trim$(txtName.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cName LIKE '" & Trim$(txtName.Text) & "%'"
    End If
    
    If Trim$(txtType.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cSupplierType LIKE '" & Trim$(txtType.Text) & "%'"
    End If
    
    If Trim$(txtSType.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cType LIKE '" & Trim$(txtSType.Text) & "%'"
    End If
    
    If Trim$(txtSCity.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cCity LIKE '" & Trim$(txtSCity.Text) & "%'"
    End If
    
    If Trim$(txtSDepartment.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cDepartment LIKE '" & Trim$(txtSDepartment.Text) & "%'"
    End If
    
    If Trim(txtSTerms.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cTerm LIKE '" & Trim$(txtSTerms.Text) & "%'"
    End If
        
    GetSearchString = Trim$(sWhere)

    Exit Function
ErrorHandler:
    GetSearchString = "ERROR"
End Function

'Sets the form if record number is zero
Private Sub RSZero()
    lblHeader = "Supplier ID - Supplier Name"
    sbRS.Panels(1) = "Record: 0/0"
    sbRS.Panels(2) = ""
    
    Set dtgSAddress.DataSource = Nothing
    Set dtgSProduct.DataSource = Nothing
    dtgSAddress.Refresh
    dtgSProduct.Refresh
        
    Set dtgSHistory.DataSource = Nothing
    dtgSHistory.Refresh
    dtbSFrom.Text = "__/__/____"
    dtbSTo.Text = "__/__/____"

    Set FrmName = Me
    UnbindControls
    TextClearing
    FormLocking True
    
    If rsSAddress.State = adStateOpen Then rsSAddress.Close
    If rsSProduct.State = adStateOpen Then rsSProduct.Close
    If rsHeader.State = adStateOpen Then rsHeader.Close
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    
    txtCode.Locked = False
    txtCode.SetFocus
    
    Mode = Find
End Sub

Sub SearchObj(lEnable As Boolean)
    cboType.Enabled = lEnable
    cboSType.Enabled = lEnable
    cmdPickSDept.Enabled = lEnable
    cboSTerms.Enabled = lEnable
End Sub

'Show the balances of each customer
'Binding of the textboxex was disabled
Private Sub ShowSupplierBalance()
Dim rsBalance As New Recordset

    If Mode = AddNewEdit Then Exit Sub
    
    sSQL = "SELECT *, ISNULL((nPurchase - nReturns - nPaid + nCredit - nDebit), 0) AS nBalance " & _
            "FROM V_SupplierBalanceInquiry WHERE cCode = '" & rsHeader!cCode & "' AND cCompanyID = '" & COID & "'"
    rsBalance.Open sSQL, cn, adOpenForwardOnly, adLockReadOnly
    
    txtSPurchase = 0
    txtSDebit = 0
    txtSCredit = 0
    txtSReturns = 0
    txtSPayment = 0
    txtSBalance = 0
    
    If rsBalance.RecordCount <> 0 Then
        txtSPurchase = rsBalance!nPurchase
        txtSDebit = rsBalance!nDebit
        txtSCredit = rsBalance!nCredit
        txtSReturns = rsBalance!nReturns
        txtSPayment = rsBalance!nPaid
        txtSBalance = rsBalance!nBalance
    End If
    
    
    Set rsBalance = Nothing
    
End Sub

'Public Sub ShowForm(sTranNo As String)
'
'    If Mode = Find Then
'
'        OpenNewConnection connHeader
'        OpenNewConnection connSAddress
'        OpenNewConnection connSProduct
'
'        Set rsHeader = Nothing
'        Set rsSAddress = Nothing
'        Set rsSProduct = Nothing
'        Set rsHeader = New ADODB.Recordset
'        Set rsSAddress = New ADODB.Recordset
'        Set rsSProduct = New ADODB.Recordset
'
'        OpenRecordsetWithCN rsSProduct, "*", "CLIENT_SUPPLIER_ITEM", connSProduct, "WHERE cCode = '" & Trim(sTranNo) & "'"
'        OpenRecordsetWithCN rsSAddress, "*", "CLIENT_SUPPLIER_ADD", connSAddress, "WHERE cCode = '" & Trim(sTranNo) & "'"
'        OpenRecordsetWithCN rsHeader, "*", "CLIENT_SUPPLIER", connHeader, "WHERE cCode = '" & Trim(sTranNo) & "'"
'
'        Set FrmName = Me
'        FormLocking True
'        cmdSHistory.Enabled = True
'        dtbSFrom.Enabled = True
'        dtbSTo.Enabled = True
'
'        If rsHeader.RecordCount = 0 Then
'            FormWaitHide
'            MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
'            RSZero
'            FormSearch True
'            SearchObj True
'            Mode = Find
'            Exit Sub
'        End If
'            SetDataSource
'            SetDataField
'            txtCode.BackColor = &HE0FFFF
'            Mode = Normal
'            oBar.BitEnabled Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True, True
'
'    End If
'End Sub


Sub Show_Report()
Dim MyReport As New Report
Dim ReportApp As New CRAXDDRT.Application
Dim cmdReport As ADODB.Command
Dim rsReport As ADODB.Recordset

  Set cmdReport = New ADODB.Command
  Set rsReport = New ADODB.Recordset
  rsReport.CursorLocation = adUseClient
  cReportName = "APAgingSupplier.RPT"

    With cmdReport
        .ActiveConnection = cn
        .CommandTimeout = 1000
        .CommandText = "rsp_APAgingSupplier"
        .CommandType = adCmdStoredProc
        .Parameters("@cFrom") = txtCode
        .Parameters("@dDateFrom") = Format(Now - nInterval, "mm/dd/yyyy")
        .Parameters("@dDateTo") = Format(Now, "mm/dd/yyyy")
        .Parameters("@cCompID") = COID
        .Parameters("@nInterval") = nInterval
        .Parameters("@lBit") = 1
        .Parameters("@cValue1") = "1 - " & nInterval
        .Parameters("@cValue2") = str(nInterval + 1) & " - " & str(nInterval * 2)
        .Parameters("@cValue3") = str((nInterval * 2) + 1) & " - " & str(nInterval * 3)
        .Parameters("@cValue4") = str((nInterval * 3) + 1) & " - " & str(nInterval * 4)
        .Parameters("@cValue5") = "Over " & str(nInterval * 5)
        
    End With
    nVarInterval = nInterval
    Set rsReport = cmdReport.Execute()

    Set MyReport = ReportApp.OpenReport(App.Path & "\crystal reports\" & cReportName)
    MyReport.Database.SetDataSource rsReport
    
    With MyReport
            .FormulaFields.GetItemByName("dToday").Text = "'" & Format(Now, "mm/dd/yyyy") & "'"
            .FormulaFields.GetItemByName("cCustomerNo").Text = "'" & Trim(txtCode) & "'"
            .FormulaFields.GetItemByName("cCustomerName").Text = "'" & Trim(txtName) & "'"
            .FormulaFields.GetItemByName("cHeader1").Text = "'" & "1 - " & nVarInterval & "'"
            .FormulaFields.GetItemByName("cHeader2").Text = "'" & str(nVarInterval + 1) & " - " & str(nVarInterval * 2) & "'"
            .FormulaFields.GetItemByName("cHeader3").Text = "'" & str((nVarInterval * 2) + 1) & " - " & str(nVarInterval * 3) & "'"
            .FormulaFields.GetItemByName("cHeader4").Text = "'" & str((nVarInterval * 3) + 1) & " - " & str(nVarInterval * 4) & "'"
            .FormulaFields.GetItemByName("cHeader5").Text = "'" & "Over " & str(nVarInterval * 5) & "'"
    End With
    
    With frmMaintCustomerSupplier.ITGReportViewer
        .ReportSource = MyReport
        .DisplayGroupTree = False
        .ViewReport
        .Zoom 95
    End With
    Set rsReport = Nothing
End Sub

